import React, {Component } from 'react';
import './App.css';
// import Header from './components/Header';
import NavigationBar from './components/NavigationBar';
import InputBox from './components/InputBox';
import Board from './components/Board';

// 父传子、子传父（组件通信）
class App extends Component {
  constructor(props){
    super(props);
    this.state = {
      title:"向子组件传递的默认标题"
    }
  }
  receiveChildComponetsMessage(message){
    console.log(message);
    console.log(this)
  }

  render(){
    return(
      <div className="App">
        {/* <button onClick={()=>{
          this.setState({
            title:"我是向子组件传递的新的标题"
          })
        }}>点击改变向NavigationBar组件传递的数据</button> */}
        <NavigationBar title="自定义标题" sendMessage={this.receiveChildComponetsMessage}/>
        <Board />
        <InputBox />
      </div>
    )
  }
}

export default App;
